package _06_deque.my_implements;

import _06_deque.Deque;
import org.junit.Test;

/**
 * @author: mornd
 * @dateTime: 2023/6/7 - 18:13
 */
public class MyTest {
    @Test
    public void test() {
        Deque<Integer> deque = new LinkedListDeque<>(2);
        deque.offerLast(1);
        deque.offerLast(2);
        deque.offerLast(3);
//        System.out.println(deque.peekFirst());
//        System.out.println(deque.peekLast());

        System.out.println(deque.popFirst());
        System.out.println(deque.peekFirst());
    }

    @Test
    public void test2() {
        Deque<Integer> deque = new LinkedListDeque<>(2);
        deque.offerLast(1);
        deque.offerLast(2);
        deque.offerLast(3);

        System.out.println(deque.popFirst());
        System.out.println(deque.peekFirst());
    }

    @Test
    public void test3() {
        Deque<Integer> deque = new ArrayDeque<>(2);
        deque.offerLast(1);
        deque.offerFirst(2);
        System.out.println(deque.peekLast());// 1
        System.out.println(deque.popFirst()); // 2
        deque.offerLast(3);
        System.out.println(deque.popLast()); // 3
        deque.offerFirst(4);
        deque.offerFirst(5);
        System.out.println(deque); // [4,1]

    }
}
